home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
internet
/
yam_i_dodatki
/
yamserv
/
yamserv.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1996-09-25
|
5KB
|
202 lines
/* YAMServ. ARexx mail file server for YAM.
** © 1996 Juan Jesús García de Soria Lucena.
** $VER: YAMServ 1.1 (25.9.96)
*/
OPTIONS RESULTS
PARSE ARG REQ
ADDRESS YAM
YAMServFolder=-1
i=0
DO WHILE YAMServFolder=-1
setfolder i
IF RC>0 THEN DO
YAMServFolder=-2
END
ELSE DO
getfolderinfo name
IF RESULT="YAMServ" THEN DO
YAMServFolder=i
END
i=i+1
END
END
IF YAMServFolder<0 THEN DO
SAY "YAMServ folder couldn't be found."
EXIT
END
setfolder YAMServFolder
getfolderinfo max
num=RESULT
flag=0
i=0
DO WHILE i<num
setmail i
getmailinfo status
St=RESULT
IF St~='R' THEN DO
flag=1
getmailinfo subject
Subj=UPPER(RESULT)
PARSE VAR Subj Comm Pattern
Pattern=STRIP(Pattern)
IF Comm="+HELP" THEN DO
ADDRESS COMMAND 'Echo "YAMServ 1.1 (C) 1996 Juan Jesus Garcia de Soria Lucena." >T:YAMServ'
ADDRESS COMMAND 'Echo "" >>T:YAMServ'
ADDRESS COMMAND 'Echo "YAMServ HELP Page. Send these commands in your mail _subject_." >>T:YAMServ'
ADDRESS COMMAND 'Echo "" >>T:YAMServ'
ADDRESS COMMAND 'Echo " +HELP .......... This info." >>T:YAMServ'
ADDRESS COMMAND 'Echo " +LIST .......... Get list of available files." >>T:YAMServ'
ADDRESS COMMAND 'Echo " +GET pattern ... Get specified file(s) as MIME (Amiga wildcards allowed)." >>T:YAMServ'
ADDRESS COMMAND 'Echo " +GETUU pattern . Get specified file(s) as UUEncode (Amiga wildcards allowed)." >>T:YAMServ'
mailreply
writeletter "T:YAMServ"
writequeue
ADDRESS COMMAND 'Delete T:YAMServ quiet'
END
ELSE IF Comm="+LIST" THEN DO
ADDRESS COMMAND 'Echo "YAMServ 1.1 (C) 1996 Juan Jesus Garcia de Soria Lucena." >T:YAMServ'
ADDRESS COMMAND 'Echo "" >>T:YAMServ'
ADDRESS COMMAND 'Echo "These are the files currently available:" >>T:YAMServ'
ADDRESS COMMAND 'Echo "" >>T:YAMServ'
ADDRESS COMMAND 'LIST YAMServ: NOHEAD FILES >>T:YAMServ'
mailreply
writeletter "T:YAMServ"
writequeue
ADDRESS COMMAND 'Delete T:YAMServ quiet'
END
ELSE IF Comm="+GET" THEN DO
ADDRESS COMMAND 'Echo "YAMServ 1.1 (C) 1996 Juan Jesus Garcia de Soria Lucena." >T:YAMServ'
ADDRESS COMMAND 'Echo "" >>T:YAMServ'
ADDRESS COMMAND 'Echo "Your request has been processed." >>T:YAMServ'
mailreply
writeletter "T:YAMServ"
ADDRESS COMMAND 'LIST "YAMServ:'Pattern'" QUICK NOHEAD >T:YAMServ'
SAY 'LIST "YAMServ:'Pattern'" QUICK NOHEAD >T:YAMServ'
IF OPEN('file',"T:YAMServ",'R') THEN DO
DO WHILE ~EOF('file')
fname=READLN('file')
'writeattach FILENAME "YAMServ:'fname'" DESC "YAMServ attachment" ENCMODE MIME'
END
CALL CLOSE('file')
END
ELSE DO
ADDRESS COMMAND 'Echo "YAMServ 1.1 (C) 1996 Juan Jesus Garcia de Soria Lucena." >T:YAMServ'
ADDRESS COMMAND 'Echo "" >>T:YAMServ'
ADDRESS COMMAND 'Echo "Your request couldn''t be processed because of a server error." >>T:YAMServ'
writeletter "T:YAMServ"
END
writequeue
ADDRESS COMMAND 'Delete T:YAMServ quiet'
END
ELSE IF Comm="+GETUU" THEN DO
ADDRESS COMMAND 'Echo "YAMServ 1.1 (C) 1996 Juan Jesus Garcia de Soria Lucena." >T:YAMServ'
ADDRESS COMMAND 'Echo "" >>T:YAMServ'
ADDRESS COMMAND 'Echo "Your request has been processed." >>T:YAMServ'
mailreply
writeletter "T:YAMServ"
ADDRESS COMMAND 'LIST "YAMServ:'Pattern'" QUICK NOHEAD >T:YAMServ'
SAY 'LIST "YAMServ:'Pattern'" QUICK NOHEAD >T:YAMServ'
IF OPEN('file',"T:YAMServ",'R') THEN DO
DO WHILE ~EOF('file')
fname=READLN('file')
'writeattach FILENAME "YAMServ:'fname'" DESC "YAMServ attachment" ENCMODE UU'
END
CALL CLOSE('file')
END
ELSE DO
ADDRESS COMMAND 'Echo "YAMServ 1.1 (C) 1996 Juan Jesus Garcia de Soria Lucena." >T:YAMServ'
ADDRESS COMMAND 'Echo "" >>T:YAMServ'
ADDRESS COMMAND 'Echo "Your request couldn''t be processed because of a server error." >>T:YAMServ'
writeletter "T:YAMServ"
END
writequeue
ADDRESS COMMAND 'Delete T:YAMServ quiet'
END
ELSE DO
ADDRESS COMMAND 'Echo "YAMServ 1.1 (C) 1996 Juan Jesus Garcia de Soria Lucena." >T:YAMServ'
ADDRESS COMMAND 'Echo "" >>T:YAMServ'
ADDRESS COMMAND 'Echo "Your command was not understood. Send +HELP as _subject_ for help." >>T:YAMServ'
mailreply
writeletter "T:YAMServ"
writequeue
ADDRESS COMMAND 'Delete T:YAMServ quiet'
END
maildelete
getfolderinfo max
if RESULT<num THEN DO
i=0
END
ELSE DO
i=i+1
END
END
ELSE DO
i=i+1
END
getfolderinfo max
num=RESULT
END
IF flag=1 THEN DO
setfolder 1
getfolderinfo max
num=RESULT
i=0
DO WHILE i<num
setmail i
getmailinfo subject
Subj=UPPER(LEFT(RESULT,5))
IF Subj="RE: +" THEN DO
mailsend
getfolderinfo max
if RESULT<num THEN DO
i=0
END
ELSE DO
i=i+1
END
END
ELSE DO
i=i+1
END
getfolderinfo max
num=RESULT
END
setfolder 2
getfolderinfo max
num=RESULT
i=0
DO WHILE i<num
setmail i
getmailinfo subject
Subj=UPPER(LEFT(RESULT,5))
IF Subj="RE: +" THEN DO
maildelete
getfolderinfo max
if RESULT<num THEN DO
i=0
END
ELSE DO
i=i+1
END
END
ELSE DO
i=i+1
END
getfolderinfo max
num=RESULT
END
END
IF REQ=REQ THEN DO
ADDRESS COMMAND 'RequestChoice "YAMServ notice" "New mail has been processed." "Ok"'
END